package com.jwt.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Component
@Slf4j
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    private JwtInterceptHandler jwtInterceptHandler;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                .addInterceptor(jwtInterceptHandler)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login");
    }
}
